package com.hqyj.crmdemo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hqyj.crmdemo.entity.DevPlan;
import com.hqyj.crmdemo.entity.SaleChance;
import com.hqyj.crmdemo.mapper.SaleChanceMapper;
import com.hqyj.crmdemo.service.ISaleChanceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 何万林
 * @since 2022-10-17
 */
@Service
public class SaleChanceServiceImpl extends ServiceImpl<SaleChanceMapper, SaleChance> implements ISaleChanceService {


    @Autowired
    SaleChanceMapper mapper;

    @Override
    public SaleChance queryOne(Integer salaId) {
        SaleChance saleChance = mapper.selectById(salaId);
        return saleChance;
    }

    /**
     * 查询在销售信息表中的所有数据
     * @return
     */
    @Override
    public List<SaleChance> queryAll() {
        List<SaleChance> saleChances = mapper.selectList(null);
        return saleChances;
    }

    @Override
    public List<SaleChance> queryOne(QueryWrapper queryWrapper) {
        List<SaleChance> list = mapper.selectList(queryWrapper);
        return list;
    }


    @Override
    public Boolean add(SaleChance saleChance) {
        int insert = mapper.insert(saleChance);
        return insert > 0 ? true : false;
    }

    @Override
    public Boolean update(SaleChance saleChance) {
        int update = mapper.updateById(saleChance);
        return update > 0 ? true : false;
    }

    @Override
    public Boolean delete(Integer salaId) {
        int delete = mapper.deleteById(salaId);
        return delete > 0 ? true : false;
    }

}
